import React from "react";
import {
    sortItemsByTime
  } from "./utils";

import { SortOrder } from "antd/es/table/interface";
import { Task} from "./types";
import {Tooltip} from "antd";


export const overdueTasksColumns = [
    {
      title: "任务",
      dataIndex: "task",
      width: 250,
      ellipsis: {
        showTitle: false,
      },
    },
    {
      title: "状态",
      dataIndex: "status",
      width: 100,
    },
    {
      title: "提测时间",
      defaultSortOrder: "ascend" as SortOrder,
      dataIndex: "testingTime",
      width: 120,
      sorter: {
        compare:(a:Task,b:Task)=>sortItemsByTime(a,b,'testingTime'),
        multiple: 2,
      },
    },
    {
      title: "上线时间",
      dataIndex: "planOnlineTime",
      width: 120,
      sorter: {
        compare:(a:Task,b:Task)=>sortItemsByTime(a,b,'planOnlineTime'),
        multiple: 1,
      },
    },
    {
      title: "后端",
      dataIndex: "backEndLeader",
      width: 80,
    },
    {
      title: "前端",
      dataIndex: "frontEndLeader",
      width: 80,
    },
    {
      title: "测试",
      dataIndex: "testLeader",
      width: 80
    },
  ];
  
  
  export const estimationColumns = [
    {
      title: "任务",
      dataIndex: "task",
      width: 250,
      ellipsis: {
        showTitle: false,
      },
      render: (task:string) => (
        <Tooltip placement="topLeft" title={task}>
          {task}
        </Tooltip>
      ),
    },
    {
      title: "状态",
      dataIndex: "status",
      width: 100,
    },
    {
      title: "后端",
      dataIndex: "backEndLeader",
      width: 80,
    },
    {
      title: "前端",
      dataIndex: "frontEndLeader",
      width: 80,
    },
    {
      title: "测试",
      dataIndex: "testLeader",
      width: 80,
    },
    {
      title: "后端估时",
      dataIndex: "backendLaborHour",
      width: 120,
    },
    {
      title: "前端估时",
      dataIndex: "frontLaborHour",
      width: 120,
    },
    {
      title: "测试估时",
      dataIndex: "testLaborHour",
      width: 120,
    },
    {
      title: "联调时间",
      dataIndex: "integrationTime",
      width: 120,
    },
    {
      title: "提测时间",
      dataIndex: "testingTime",
      width: 120,
      defaultSortOrder: "ascend" as SortOrder,
      sorter: {
        compare: (a:Task,b:Task)=>sortItemsByTime(a,b,'testingTime'),
        multiple: 1,
      },
    },
    {
      title: "测试完成时间",
      dataIndex: "finishTestingTime",
      width: 120,
    },
    {
      title: "测试完成时间",
      dataIndex: "finishTestingTime",
      width: 120,
    },
    // 添加其他列
  ];
  
export const commonColumns = [
    {
      title: "任务",
      dataIndex: "task",
      width: 250,
      ellipsis: {
        showTitle: false,
      },
      render: (task:string) => (
        <Tooltip placement="topLeft" title={task}>
          {task}
        </Tooltip>
      ),
    },
    {
      title: "状态",
      dataIndex: "status",
      width: 100,
    },
    {
      title: "负责人",
      dataIndex: "projectPositionOne",
      width: 80,
    },
    {
      title: "后端",
      dataIndex: "backEndLeader",
      width: 80,
    },
    {
      title: "前端",
      dataIndex: "frontEndLeader",
      width: 80,
    },
    {
      title: "测试",
      dataIndex: "testLeader",
      width: 80,
    },
    {
      title: "联调时间",
      dataIndex: "integrationTime",
      width: 120,
    },
    {
      title: "提测时间",
      dataIndex: "testingTime",
      width: 120,
      defaultSortOrder: "ascend" as SortOrder,
      sorter: {
        compare:  (a:Task,b:Task)=>sortItemsByTime(a,b,'testingTime'),
        multiple: 2,
      },
    },
    {
      title: "测试完成时间",
      dataIndex: "finishTestingTime",
      width: 120
    },
    {
      title: "上线时间",
      dataIndex: "planOnlineTime",
      width: 120,
      defaultSortOrder: "ascend" as SortOrder,
      sorter: {
        compare: (a:Task,b:Task)=>sortItemsByTime(a,b,'planOnlineTime'),
        multiple: 1,
      },
    },
    // 添加其他列
  ];